#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    int x, y;
    cin >> x >> y;
    cout << 2 * y + x << endl;
    // cout <<  min({ 5*x, 3*x+y, 2*y+x }) << endl;
  }
  return 0;
}